home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / DApp / GopherPup.cpp next >
C/C++ Source or Header  |  1996-07-05  |  17KB  |  634 lines

  1. // GopherPup.cp
  2. // d.g.gilbert -- gopher+ client, from GopherApp
  3. // Jan 1994
  4.  
  5.  
  6. #include <DClap.h>
  7. #include <DRich.h>
  8. #include <DNet.h>
  9. #include <DDrawPICT.h>
  10.  
  11.  
  12.  
  13. class DGopherPup : public DApplication
  14. {
  15. public:
  16.     static char* kBugmailAddress;
  17.     static char* kGopherRTFDocSuffix;
  18.     //DRTFsetup        * fRTFsetup;    
  19.     //DHTMLsetup    * fHTMLsetup;    
  20.     char*            fGopherDocSuffix;
  21.     
  22.     enum appMenus { kInternetMenu = 100, kPrefsMenu }; // kViewKindMenu, kViewChoiceMenu 
  23.     enum internetMenu { 
  24.         kViewPrefs=1001,  kOtherPrefs, kEditGopherMap,
  25.         kViewByDefault,kViewByDate,kViewBySize,kViewByName,kViewByKind,kViewByHost,
  26.         kViewAsText, kViewAsLink,
  27.         kOpenDoc, kFetchLink, kFetchDefault, // kFetchView1...kFetchViewN
  28.         kFetchOptionFlag, kAutoloadFlag,
  29.         kGetInfo, kMailAdmin, kOpenLocalGo,
  30.         kNewServer,kFindServer,kNewLink, kEditLink, kExtractGodoc,kLockWindow,
  31.         kMailSetup, kSendMail, kBugMail
  32.         };
  33.         
  34.     DView *    fFetchOptionMenuItem;
  35.     DView *    fLockWinMenuItem;
  36.     DView * fAutoloadItem;
  37.  
  38.     void IGopherPup(void);     
  39.     virtual ~DGopherPup();
  40.     void DoAboutBox();
  41.  
  42.     virtual void SetUpMenus(void);    // override
  43.     virtual    Boolean IsMyAction(DTaskMaster* action); //override
  44.     virtual Boolean IsInternetMenu(DTaskMaster* action); 
  45.     virtual    void UpdateMenus(void); // override
  46.     virtual void OpenDocument(DFile* aFile);
  47.     virtual void OpenHelp(DFile* aFile); // override
  48.     virtual void OpenLocalGopher();
  49.  
  50. };
  51.  
  52.  
  53. char* DGopherPup::kBugmailAddress= "gopherpup@bio.indiana.edu";
  54. char* DGopherPup::kGopherRTFDocSuffix = ".start";
  55.  
  56.  
  57.     // here we go -- the Nlm_Main() program (called from main() in ncbimain.c)
  58. extern "C" short Main(void)
  59. {
  60.   DGopherPup* gopherpup = new DGopherPup();
  61.   gopherpup->IGopherPup();
  62.   gopherpup->Run();
  63.   delete gopherpup; 
  64.   return 0;
  65. }
  66.  
  67.  
  68.  
  69. DGopherPup::~DGopherPup()
  70. {
  71.     DGoviewPrefs::SaveGlobals();
  72.     DGoOtherPrefs::SaveGlobals();
  73.     DDrawPict::Cleanup();
  74. }
  75.  
  76.  
  77. void DGopherPup::IGopherPup(void)
  78. {
  79.     char *onoffs;
  80. #ifdef OS_DOS
  81.     // damn 8char filename limits !
  82.     DApplication::kName= "GophPup";
  83. #else
  84.     DApplication::kName= "GopherPup";
  85. #endif
  86.     DApplication::kVersion= " v 0.3d";
  87.     
  88.     fFetchOptionMenuItem= NULL;
  89.     fLockWinMenuItem= NULL;
  90.     fAutoloadItem = NULL;
  91.     gGopherDoc = NULL; // ??? this should be set, but isn't in 68K ??
  92.  
  93.     IApplication();
  94.     InitializeUGopher();
  95.     //gIconList->ReadAppIcons(); //Read("GopherPup.icons");
  96.     gGopherIcons= gIconList;     // is this what we want??
  97.     gIconSize= 2; // need to read in some app prefs  
  98.     DGoviewPrefs::InitGlobals();
  99.     DGoOtherPrefs::InitGlobals();
  100.     if (fFetchOptionMenuItem) 
  101.         fFetchOptionMenuItem->SetStatus(DGopherListDoc::gOptionIsOn);
  102.     if (fAutoloadItem) 
  103.         fAutoloadItem->SetStatus(DGoLinkedTextDoc::gAutoloadInlines);
  104.  
  105.     DRichView::InitRichView();
  106.     //fRTFsetup = new DRTFsetup(); // depends on gFileManager created in IApplication
  107.     //fHTMLsetup= new DHTMLsetup();
  108.     
  109.     fAcceptableFileTypes = NULL;     // really want "IGo4 BKMK TEXT" and perhaps others
  110.                                                                 // but NCBI tools only handle 1 type now
  111. // This is a PAIN to have 1 default suffix when several are supported
  112.     fFileSuffix = NULL; // unix, msdos file suffix
  113.  
  114.     fGopherDocSuffix= DGopherListDoc::kGopherDocSuffix;
  115.     {
  116.         // open default gopher document if it exists.
  117.         // TRY RTF Form first (.start ?? )
  118.         // open both default.go4 and default.start files, if they exist !
  119.     char godefault[512];
  120.  
  121.     StrNCpy(godefault, (char*)Shortname(), 512);    
  122.     StrNCat(godefault, fGopherDocSuffix, 512);
  123.     DFile *goFile= new DFile( godefault, "r");
  124.     if (goFile->Exists()) OpenDocument( goFile);
  125.     else delete goFile;
  126.  
  127.     StrNCpy(godefault, (char*)Shortname(), 512);    
  128.     StrNCat(godefault, kGopherRTFDocSuffix, 512);
  129.     DFile * richFile= new DFile( godefault, "r");
  130.     if (richFile->Exists()) OpenDocument( richFile);
  131.     else delete richFile;
  132.     }
  133. }     
  134.  
  135.  
  136. void DGopherPup::DoAboutBox()
  137. {
  138.     char aboutMe[512];
  139.     sprintf( aboutMe, "GopherPup, version %s"LINEEND" an Internet Gopher client ",
  140.                 DApplication::kVersion);
  141.     DAboutBoxWindow* about = new DAboutBoxWindow(aboutMe);
  142. }
  143.  
  144. void DGopherPup::SetUpMenus(void)
  145. {
  146.     DMenu* aMenu = NULL;
  147.     //DApplication::SetUpMenus();
  148.  
  149. #ifdef WIN_MAC
  150.     DAppleMenu* appleMenu = new DAppleMenu(this,fAboutLine);
  151. #endif
  152.     if (!aMenu) aMenu = this->NewMenu( cFileMenu, "File");
  153. #ifndef WIN_MAC
  154.     aMenu->AddItem(kAbout, fAboutLine);
  155.     aMenu->AddSeparator();
  156. #endif
  157.     aMenu->AddItem(kNew,"New/N", false, true);
  158.     //gViewCentral->DisableView(kNew); //?? didn't disable !?  
  159.     aMenu->AddItem(kOpen,"Open Local.../O",false, true);
  160.     aMenu->AddItem(kOpenLocalGo,"Open Local gopher...",false, true);
  161.     aMenu->AddItem(kNewServer,"Open Remote.../R",false, true);
  162.     aMenu->AddSeparator();
  163.     aMenu->AddItem(kClose,"Close/W",false, true);
  164.     aMenu->AddItem(kSave,"Save/S",false, true);
  165.     aMenu->AddItem(kSaveAs,"Save As...",false, true);
  166.     aMenu->AddSeparator();
  167.     aMenu->AddItem(kPrint,"Print",false, true);
  168.     aMenu->AddItem(kHelp,"Help/H",false, true);
  169.     aMenu->AddSeparator();
  170.     aMenu->AddItem(kQuit,"Quit/Q",false, true);
  171.  
  172.     aMenu= NULL;
  173.     this->SetUpMenu(DApplication::cEditMenu, aMenu);
  174.  
  175.     DMenu* iMenu = NewMenu( kInternetMenu, "Internet");
  176.  
  177. #ifndef BOBS_WIN_MAC                        
  178.     // vibrant doesn't have methods to remove/rearrange items in existing menus for other wins
  179.     iMenu->AddItem(  DGopherListDoc::kViewChoiceMenu, "Fetch by view...");
  180.     //fViewsMenu= NULL;
  181.     DGopherListDoc::gViewChoiceMenu = NULL;
  182. #else                    
  183.     DMenu* aMenu= new DSubMenu( DGopherListDoc::kViewChoiceMenu, iMenu, "Fetch by view");
  184.     aMenu->AddItem( DGopherListDoc::kViewDefault, "default");
  185.     DGopherListDoc::gViewChoiceMenu = aMenu;
  186.     // add/remove alternate views here, depending on selected gopher item
  187.     aMenu->suicide(1);
  188. #endif // WIN_MAC                        
  189.  
  190.     iMenu->AddItem( kLockWindow,    "Tack window",true, true);                        
  191.     fLockWinMenuItem= (DView*) gViewCentral->GetView(kLockWindow);
  192.     DGopherListDoc::gLockWinMenuItem = fLockWinMenuItem;
  193.     
  194.     iMenu->AddItem( kExtractGodoc,"Extract links in netdoc...",false, true);                        
  195.  
  196.     DMenu* vMenu= new DSubMenu( DGopherListDoc::kViewKindMenu, iMenu, "View links");
  197.     vMenu->AddItem( DGopherListDoc::kViewByDefault, "default");
  198.     vMenu->AddItem( DGopherListDoc::kViewByDate, "by Date");
  199.     vMenu->AddItem( DGopherListDoc::kViewBySize, "by Size");
  200.     vMenu->AddItem( DGopherListDoc::kViewByName, "by Name");
  201.     vMenu->AddItem( DGopherListDoc::kViewByKind, "by Kind");
  202.     vMenu->AddItem( DGopherListDoc::kViewByHost, "by Host");
  203.     vMenu->AddItem( DGopherListDoc::kViewAsText, "as Text");
  204.     vMenu->AddItem( DGopherListDoc::kViewAsLink, "as Link text");
  205.  
  206.     iMenu->AddSeparator();    
  207.     
  208.   //    iMenu->AddItem( kNewServer,     "Open remote.../R",false, true);
  209.      iMenu->AddItem( kFindServer,     "Find server of link",false, true);
  210.     iMenu->AddItem( kNewLink,         "New link...",false, true);
  211.     iMenu->AddItem( kEditLink,         "Edit link...",false, true);                        
  212.     iMenu->AddSeparator();                                
  213.  
  214.      //iMenu->AddItem( kGetInfo,         "Get Info from link/I",false, true);
  215.      iMenu->AddItem( kMailAdmin,        "Mail to link maintainer...",false, true);
  216.     //iMenu->AddSeparator();                                
  217.     iMenu->AddItem( kSendMail,         "Send Mail...",false, true);
  218.     iMenu->AddItem( kBugMail,         "Comment on this app...",false, true);
  219.         
  220.     
  221.     iMenu = NewMenu( kPrefsMenu, "Options");
  222.     iMenu->AddItem( kViewPrefs, "View Prefs...",false, true); 
  223.  
  224.     iMenu->AddItem( kFetchOptionFlag, "Fetch with options", true, true);
  225.         // we can only access menu item thru gViewCentral now the way DMenu::AddItem() is written...
  226.     fFetchOptionMenuItem= (DView*) gViewCentral->GetView(kFetchOptionFlag);
  227.  
  228.     iMenu->AddItem( kAutoloadFlag, "Autoload images", true, true);
  229.     fAutoloadItem= (DView*) gViewCentral->GetView(kAutoloadFlag);
  230.     iMenu->AddItem( kEditGopherMap, "Edit view handlers...",false, true);
  231.     iMenu->AddItem( kOtherPrefs,     "Other prefs...",false, true);
  232.     iMenu->AddItem( kMailSetup,     "Mail setup...",false, true);
  233.  
  234.  
  235.     aMenu= NULL;
  236.     this->SetUpMenu(DApplication::cWindowMenu, aMenu);
  237.  
  238. }
  239.  
  240.  
  241.  
  242.  
  243.  
  244. class    DBugMailDialog : public DSendMailDialog
  245. {
  246. public:
  247.     DBugMailDialog(long id, DTaskMaster* itsSuperior,
  248.         short width = -5, short height = -5, short left = -50, short top = -20, char* title = NULL):
  249.         DSendMailDialog(id, itsSuperior, width, height, left, top, title)
  250.         {}
  251.  
  252.     virtual DView* InstallTo(DView* super, char* toStr)  //override
  253.     {
  254.         return DSendMailDialog::InstallTo(super, DGopherPup::kBugmailAddress);
  255.     }
  256.     
  257. };
  258.  
  259.  
  260. class    DAdminMailDialog : public DSendMailDialog
  261. {
  262. public:
  263.     DGopher* fGopher;
  264.     
  265.     DAdminMailDialog(long id, DTaskMaster* itsSuperior, DGopher* theGopherItem):
  266.         DSendMailDialog(id, itsSuperior, -5, -5, -50, -20, "Mail gopher admin"),
  267.         fGopher(theGopherItem)
  268.     {
  269.         // FailNIL(fGopher);
  270.         fGopher->newOwner();
  271.     }
  272.     
  273.     virtual ~DAdminMailDialog()
  274.     {
  275.         fGopher->suicide();
  276.     }
  277.     
  278.     virtual DView* InstallMessage(DView* super, char* msgStr)
  279.     {
  280.         char* txt= (char*) MemGet(1, true);
  281.         StrExtendCat( &txt, "Regarding the gopher item on your server, specified as:");
  282.         StrExtendCat( &txt, LineEnd);
  283.         fGopher->ToServerText( txt, 0);
  284.         DView* msg= DSendMailDialog::InstallMessage(super, txt);
  285.         MemFree(txt);
  286.         return msg;
  287.     }
  288.  
  289.     virtual DView* InstallSubject(DView* super, char *subjStr)  //override
  290.     {
  291.         char  addrbuf[256];
  292.         StrCpy( addrbuf, "Re: gopher item <");
  293.         StrNCat( addrbuf, fGopher->GetName(), 255);
  294.         StrNCat( addrbuf, ">", 255);
  295.         return DSendMailDialog::InstallSubject(super, addrbuf);
  296.     }
  297.     
  298.     
  299.     virtual DView* InstallTo(DView* super, char* toStr)  //override
  300.     {
  301.         char  *ep, *addr, addrbuf[256];
  302.         StrNCpy( addrbuf, fGopher->fAdminEmail, 255);
  303.         addr= StrChr( addrbuf, '<');
  304.         if (addr) addr++; else addr= addrbuf;
  305.         ep= StrChr( addr, '>');
  306.         if (ep) *ep= 0;
  307.         return DSendMailDialog::InstallTo(super, addr);
  308.     }
  309.     
  310. };
  311.  
  312.  
  313.  
  314. void DGopherPup::OpenHelp( DFile* aFile)
  315. {
  316.     if (!aFile || !aFile->Exists()) {
  317.         Message(MSG_OK,"Can't find help file '%s'",aFile->GetName());
  318.         return;
  319.         }
  320.     fGopherDocSuffix= ".goh";
  321.     this->OpenDocument( aFile); 
  322.     fGopherDocSuffix= DGopherListDoc::kGopherDocSuffix;
  323.     //DApplication::OpenHelp(aFile);
  324. }
  325.  
  326.  
  327.  
  328. class DLocalDialog : public DWindow
  329. {
  330. public:
  331.     enum { kSetDefault = 13345 };
  332.     DEditText* fQuery;
  333.     DLocalDialog();            
  334.     char* Result();
  335.     void OkayAction();
  336. };
  337.  
  338.  
  339. DLocalDialog::DLocalDialog() :
  340.     DWindow( 0, gApplication, fixed, -10, -10, -50, -20, "Local Gopher", kDontFreeOnClose)
  341. {
  342.         new DPrompt(0, this, "Open local folder?", 0, 0, Nlm_systemFont);             
  343.         this->NextSubviewBelowLeft();
  344.         fQuery= new DEditText(0, this, gLocalGopherRoot, 28); 
  345.         this->SetEditText(fQuery);
  346.         this->NextSubviewBelowLeft();
  347.         (void) new DCheckBox(kSetDefault,this,"Make this default local services folder");
  348.         this->AddOkayCancelButtons();
  349. }
  350.             
  351. void DLocalDialog::OkayAction() 
  352.     DWindow::OkayAction();
  353.     DCheckBox* ck = (DCheckBox*) this->FindSubview(kSetDefault);
  354.     if (ck && ck->GetStatus()) {
  355.         char* newroot= fQuery->GetText(); // this dups text
  356.         if (newroot) {
  357.             MemFree(gLocalGopherRoot);
  358.             gLocalGopherRoot= newroot;
  359.             }
  360.         }
  361. }
  362.  
  363. char* DLocalDialog::Result()
  364. {
  365.     if (fOkay) return fQuery->GetText();
  366.     else return NULL;
  367. }
  368.  
  369.  
  370. void DGopherPup::OpenLocalGopher()
  371. {
  372.     DLocalDialog* win= new DLocalDialog();
  373.     if ( win->PoseModally() ) {
  374.         char* localpath= win->Result();
  375.       DGopher* localgo= DGopherList::LocalGopher( localpath);
  376.         MemFree( localpath);
  377.       DGopherListDoc::ProcessGopher( localgo, 0);
  378.       }
  379.     delete win;  
  380. }
  381.         
  382.  
  383.  
  384. void DGopherPup::OpenDocument(DFile* aFile)
  385. {
  386.     if (!aFile || !aFile->Exists()) return;
  387.     gCursor->watch();
  388. #if 1
  389.     aFile->Close();
  390.   DGopher* localgo= DGopherList::LocalGopher( aFile);
  391.   DGopherListDoc::ProcessGopher( localgo, 0);
  392. #else
  393.     if (DGopherListDoc::IsGopherDoc(aFile)) {
  394.         DGopherListDoc::ProcessFile( aFile);
  395.         }
  396.     else {
  397.         DFile* bFile= NULL;
  398.         char    name[512];
  399.         StrNCpy(name, aFile->GetName(), 512);
  400.         gFileManager->ReplaceSuffix(name, 512, fGopherDocSuffix);
  401.         if (gFileManager->FileExists( name))  
  402.             bFile= new DFile(name, "r");
  403.         if ( gGopherTextDoc 
  404.          && ((DGoLinkedTextDoc*)gGopherTextDoc)->PushNewLocalDoc(aFile, bFile) ) 
  405.             ;
  406.         else {
  407.             DGoLinkedTextDoc* tdoc= 
  408.                 new DGoLinkedTextDoc( DGoLinkedTextDoc::kGoLitextdoc, NULL, NULL);  
  409.             tdoc->Open(aFile, bFile);   
  410.             }
  411.         }
  412. #endif
  413.     gCursor->arrow();
  414. }
  415.  
  416.  
  417.         
  418. Boolean DGopherPup::IsInternetMenu(DTaskMaster* action) 
  419. {
  420.     DWindow* win;
  421.     short     iview = 0;
  422.  
  423.     switch(action->Id()) {
  424.                 
  425.         case kViewPrefs: 
  426.             if (!gGoviewPrefs) {
  427.                 gGoviewPrefs = new DGoviewPrefs();
  428.                 gGoviewPrefs->Initialize();
  429.                 }
  430.             if (gGoviewPrefs && gGoviewPrefs->PoseModally()) ;
  431.             //delete gGoviewPrefs; // leave the window hidden but alive for later use
  432.             return true;
  433.             
  434.         case kOtherPrefs:
  435.             if (!gGoOtherPrefs) {
  436.                 gGoOtherPrefs = new DGoOtherPrefs();
  437.                 gGoOtherPrefs->Initialize();
  438.                 }
  439.             if (gGoOtherPrefs && gGoOtherPrefs->PoseModally()) ;
  440.             //delete gGoOtherPrefs; // leave the window hidden but alive for later use
  441.             return true;
  442.  
  443.         case kEditGopherMap: 
  444.             EditGopherMap(); 
  445.             return true;
  446.             
  447.         case     kOpenDoc:
  448.             //GopherDoc(); return true;
  449.             {
  450.             DTaskMaster* newact= new DTaskMaster(DApplication::kOpen, this);
  451.             Boolean result= DApplication::IsMyAction( newact);
  452.             delete newact;
  453.             return result;
  454.             }
  455.             
  456.         case  kFetchOptionFlag:
  457.             if (fFetchOptionMenuItem) DGopherListDoc::gOptionIsOn= fFetchOptionMenuItem->GetStatus();
  458.             else DGopherListDoc::gOptionIsOn = !DGopherListDoc::gOptionIsOn; // or read menu state
  459.             return true;
  460.  
  461.         case  kAutoloadFlag:
  462.             if (fAutoloadItem) DGoLinkedTextDoc::gAutoloadInlines= fAutoloadItem->GetStatus();
  463.             else DGoLinkedTextDoc::gAutoloadInlines = !DGoLinkedTextDoc::gAutoloadInlines; // or read menu state
  464.             return true;
  465.  
  466.  
  467.         case  kExtractGodoc:
  468.             {
  469.             win= gWindowManager->CurrentWindow();
  470.             if (win && win->Id() == DGoLinkedTextDoc::kGoLitextdoc) {
  471.                 DGoLinkedTextDoc* ndoc= (DGoLinkedTextDoc *) win;
  472.                 switch (action->Id()) {
  473.                     case kExtractGodoc    : ndoc->ExtractGopherDoc(); break;
  474.                     }
  475.                 }
  476.             return true;
  477.             }
  478.  
  479.  
  480.         case  kLockWindow:
  481.             win= gWindowManager->CurrentWindow();
  482.             if (win && fLockWinMenuItem) {
  483.                 if (win->Id() == DGopherListDoc::kGoListdoc)
  484.                      ((DGopherListDoc *) win)->PinWindow( fLockWinMenuItem->GetStatus());
  485.                 else if (win->Id() == DGopherTextDoc::kGoTextdoc   
  486.                             || win->Id() == DGoLinkedTextDoc::kGoLitextdoc)  
  487.                     ((DGopherTextDoc *) win)->PinWindow( fLockWinMenuItem->GetStatus());
  488.                 }         
  489.             return true;
  490.  
  491.         case     kGetInfo:
  492.         case  kFetchLink:
  493.         case  kMailAdmin:
  494.         case    kFindServer:
  495.         case    kNewServer:
  496.         case    kNewLink:
  497.         case  kEditLink:
  498.             {
  499.             win= gWindowManager->CurrentWindow();
  500.             if (win && win->Id() == DGopherListDoc::kGoListdoc) {
  501.                 DGopher* go;
  502.                 DGopherListDoc* gdoc= (DGopherListDoc *) win;
  503.                 switch (action->Id()) {
  504.  
  505.                     case kFindServer:    gdoc->TopOfGopherHole(); break;
  506.                     case kNewServer    : gdoc->InsertNewGopher( false); break;
  507.                     case kNewLink        : gdoc->InsertNewGopher( true); break;
  508.                     case kEditLink    : gdoc->EditOldGopher(); break;
  509.                     case kGetInfo:
  510.                         iview= DGopher::kGetItemInfo;
  511.                             // fall thru to kFetchLink
  512.                     case kFetchLink:
  513.                         go= gdoc->fGoview->SelectedGopher();
  514.                         if (go) gdoc->ProcessGopher(go, iview);
  515.                         break;
  516.                         
  517.                     case kMailAdmin    :
  518.                         go= gdoc->fGoview->SelectedGopher();
  519.                         if (go && go->fAdminEmail) {
  520.                             win= new DAdminMailDialog(0, this, go);
  521.                             win->Open();
  522.                             }
  523.                         break;
  524.                     }
  525.                 }
  526.             return true;
  527.             }
  528.  
  529.  
  530.         case    kMailSetup:
  531.             {
  532.             win= new DMailSetupDialog(0, this, -10, -10, -20, -20, "Mail Setup");
  533.             win->Open();
  534.             return true;
  535.             }
  536.         case     kSendMail: 
  537.             {
  538.             win= new DSendMailDialog(0, this, -10, -10, -20, -20, "Send Mail");
  539.             win->Open();
  540.             return true;
  541.             }
  542.         case  kBugMail:
  543.             {
  544.             win= new DBugMailDialog(0, this, -10, -10, -20, -20, "Comment about this App");
  545.             win->Open();
  546.             return true;
  547.             }
  548.         default:    return false;
  549.         }
  550. }
  551.  
  552.  
  553. Boolean DGopherPup::IsMyAction(DTaskMaster* action) 
  554. {
  555.     DWindow* win;
  556.     DGopherListDoc* gdoc = (DGopherListDoc*) gWindowManager->CurrentWindow();
  557.     
  558.     if (action->fSuperior)  
  559.         switch (action->fSuperior->Id()) {
  560.  
  561.             case cFileMenu    : 
  562.               switch (action->Id()) {
  563.                 case kOpenLocalGo:
  564.                     OpenLocalGopher();
  565.                     return true;
  566.                 case kNewServer:
  567.                     return IsInternetMenu(action);
  568.                 case DApplication::kNew:
  569.                     DGopherListDoc::NewGopherDoc();
  570.                     return true;
  571.                  default: 
  572.                     return DApplication::IsMyAction(action);
  573.                 }
  574.                 break;
  575.  
  576.             case kInternetMenu    :
  577.             case kPrefsMenu : 
  578.                 // this is here and below due to BOBS_WIN_MAC / win_other problem
  579.                 if (action->Id() == DGopherListDoc::kViewChoiceMenu) 
  580.                     goto caseViewChoiceMenu; 
  581.                 else
  582.                     return IsInternetMenu(action);
  583.                 
  584.             case DGopherListDoc::kViewKindMenu    : 
  585.                 if (gdoc && gdoc->Id() == DGopherListDoc::kGoListdoc)
  586.                     return gdoc->IsMyAction(action);
  587.                     else return false;
  588.                 
  589.             case DGopherListDoc::kViewChoiceMenu    : 
  590.             caseViewChoiceMenu:
  591.                 if (gdoc && gdoc->Id() == DGopherListDoc::kGoListdoc)
  592.                     return gdoc->IsMyAction(action);
  593.                     else return false;
  594.             }
  595.      
  596.      
  597.     switch(action->Id()) {
  598.  
  599.         case DApplication::kNew:
  600.             DGopherListDoc::NewGopherDoc();
  601.             return true;
  602.  
  603.         case cOKAY:
  604.         case cCANC:
  605.             /// Note:  These Button OKAY/CANC messages are not necessarily from just one window --
  606.             {
  607.             DButton* but= (DButton*) action; 
  608.             if ( but && ((win= but->GetWindow()) != NULL) ) {
  609.                 if (action->Id() == cOKAY) {
  610.                     // do Okay close handling...
  611.                     }
  612.                 win->CloseAndFree();
  613.                 }
  614.             }
  615.             return true;
  616.  
  617.         default: 
  618.             return DApplication::IsMyAction(action);
  619.         }
  620. }
  621.  
  622.  
  623.  
  624. void DGopherPup::UpdateMenus(void)
  625. {
  626.     DApplication::UpdateMenus();
  627.     
  628.     //gViewCentral->EnableView(kSpecial1);
  629.     //gViewCentral->EnableView(kSpecial2);
  630. }
  631.  
  632.  
  633.